package com.kelaite.procurement.repository;

import java.util.Date;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.kelaite.procurement.entity.TSalesOrderPayment;

public interface SalesOrderPaymentRepository extends JpaRepository<TSalesOrderPayment, Long>{
	
	@Modifying
	@Query(value = "update t_sales_order_payment o set o.acceptanceReportAttachmentStatus =:acceptanceReportAttachmentStatus, o.gmtUpdateTime =:gmtUpdateTime, o.updatedBy =:updatedBy where o.id =:id")
	public int updatePurchaseReportStatus(@Param("id") Long id,
			@Param("acceptanceReportAttachmentStatus") int acceptanceReportAttachmentStatus,
			@Param("gmtUpdateTime") Date gmtUpdateTime,
			@Param("updatedBy") String updatedBy);
	
	@Modifying
	@Query(value = "update t_sales_order_payment o set o.invoiceAttachmentStatus1 =:invoiceAttachmentStatus1, o.gmtUpdateTime =:gmtUpdateTime, o.updatedBy =:updatedBy where o.id =:id")
	public int updatePurchaseInvoiceStatus1(@Param("id") Long id,
			@Param("invoiceAttachmentStatus1") int invoiceAttachmentStatus1,
			@Param("gmtUpdateTime") Date gmtUpdateTime,
			@Param("updatedBy") String updatedBy);
	
	@Modifying
	@Query(value = "update t_sales_order_payment o set o.invoiceAttachmentStatus2 =:invoiceAttachmentStatus2, o.gmtUpdateTime =:gmtUpdateTime, o.updatedBy =:updatedBy where o.id =:id")
	public int updatePurchaseInvoiceStatus2(@Param("id") Long id,
			@Param("invoiceAttachmentStatus2") int invoiceAttachmentStatus2,
			@Param("gmtUpdateTime") Date gmtUpdateTime,
			@Param("updatedBy") String updatedBy);
}
